<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\shop\info;

class Subscribe extends \longbingcore\diy\BaseSubscribe
{
    public function onAddWorkCenterModelMenu()
    {
        $permissson = new PermissionShop($this->_uniacid);
        if($permissson->pAuth()) {
            $modelMenu = ["title" => "商品服务", "desc" => "", "show" => true, "row" => 4, "list" => [["title" => "我的收入", "icon" => "icontixianguanli", "link" => "/shop/pages/partner/income", "linkType" => 4], ["title" => "订单管理", "icon" => "iconwodedingdan", "link" => "/shop/pages/order/list?target=staff", "linkType" => 4], ["title" => "退款管理", "icon" => "iconwodeshouhou", "link" => "/shop/pages/refund/list?target=staff", "linkType" => 4], ["title" => "推荐商品", "icon" => "icontuijianshangpin", "link" => "/shop/pages/staff/goods/push", "linkType" => 4], ["title" => "卡券管理", "icon" => "iconwodekaquan", "link" => "/shop/pages/staff/coupon/list", "linkType" => 4]]];
            return [$modelMenu];
        }
        return [];
    }
    public function onCardInfo($params)
    {
        $modelExtension = new \app\card\model\CardExtension();
        $goods_list = $modelExtension->cardExtensionList($params["staff_id"], $this->_uniacid);
        $collage_model = new \app\shop\model\IndexShopCollage();
        foreach ($goods_list as $key => $val) {
            $goods_list[$key]["is_collage"] = 0;
            $count = $collage_model->getCollage(["goods_id" => $val["id"], "uniacid" => $this->_uniacid, "status" => 1]);
            if(!empty($count)) {
                $goods_list[$key]["is_collage"] = 1;
            }
        }
        return ["goods_list" => $goods_list];
    }
    public function onStaffCustomerList($data)
    {
        $orderCount = \app\radar\model\RadarOrder::where([["pay_status", "=", 1], ["order_status", "<>", 1], ["user_id", "=", $data["uid"]], ["to_uid", "=", $data["to_uid"]], ["refund_status", "=", 0]])->count();
        $returnData["count"] = $orderCount;
        $returnData["title"] = "订单";
        return [$returnData];
    }
    public function onDiyModuleMenuShop($data)
    {
        if(!empty($data["data"]["list"])) {
            foreach ($data["data"]["list"] as $v) {
                if($v["icon"] != "icontemplate" || $data["shop_auth"]) {
                    $arr[] = $v;
                }
            }
            $data["data"]["list"] = $arr;
        }
        return $data;
    }
    public function onAddUcenterCompoent()
    {
        $this->getUserId();
        $user = longbingGetUserInfo($this->getUserId(), $this->_uniacid);
        $last_staff_id = !empty($user["last_staff_id"]) ? $user["last_staff_id"] : 0;
        $moduleMenuShopOrder = "{\n    \"title\": \"商城订单\",\n    \"type\": \"moduleMenuShopOrder\",\n    \"icon\": \"iconshoporder\",\n    \"isDelete\": true,\n    \"addNumber\": 1,\n    \"attr\": [\n        {\n            \"title\": \"模板名称\",\n            \"type\": \"Switch\",\n            \"name\": \"isShowTitle\"\n        },\n        {\n            \"title\": \"选择模板\",\n            \"type\": \"ChooseModule\",\n            \"name\": \"module\",\n            \"data\": [\n                {\n                    \"title\": \"一行多列\",\n                    \"name\": \"module-menu-row\",\n                    \"img\": \"http://longbingcdn.xiaochengxucms.com/admin/diy/module-menu-col.jpg\"\n                },\n                {\n                    \"title\": \"一行一列\",\n                    \"name\": \"module-menu-col\",\n                    \"img\": \"http://longbingcdn.xiaochengxucms.com/admin/diy/module-menu-row.jpg\"\n                }\n            ]\n        },\n        {\n            \"title\": \"一行多少列\",\n            \"type\": \"InputNumber\",\n            \"name\": \"row\"\n        }\n    ],\n    \"data\": {\n        \"isShowTitle\": false,\n        \"module\": \"module-menu-row\",\n        \"row\": {\n            \"number\": 4,\n            \"min\": 2,\n            \"max\": 5,\n            \"label\": \"请输入\"\n        },\n        \"list\": [\n            {\n                \"title\": \"全部\",\n                \"icon\": \"iconwodedingdan\",\n                \"link\": {\n                    \"type\": 2,\n                    \"url\": \"/shop/pages/order/list?index=0\"\n                }\n            },\n            {\n                \"title\": \"待付款\",\n                \"icon\": \"icondingdandaifukuan\",\n                \"link\": {\n                    \"type\": 2,\n                    \"url\": \"/shop/pages/order/list?index=1\"\n                }\n            },\n            {\n                \"title\": \"待发货\",\n                \"icon\": \"icondingdandaifahuo\",\n                \"link\": {\n                    \"type\": 2,\n                    \"url\": \"/shop/pages/order/list?index=2\"\n                }\n            },\n            {\n                \"title\": \"待收货\",\n                \"icon\": \"icondingdandaishouhuo\",\n                \"link\": {\n                    \"type\": 2,\n                    \"url\": \"/shop/pages/order/list?index=3\"\n                }\n            },\n            {\n                \"title\": \"已完成\",\n                \"icon\": \"icondingdanyiwancheng\",\n                \"link\": {\n                    \"type\": 2,\n                    \"url\": \"/shop/pages/order/list?index=4\"\n                }\n            }\n            \n        ]\n    }\n}";
        $tmp = sassAuth() == 1 ? ",\n            {\n            \n                \"title\": \"我的采购模板\",\n                \n                \"icon\": \"icontemplate\",\n                \n                \"link\": {\n                \n                    \"type\": 2,\n                    \n                    \"url\": \"/shop/pages/purchase/list?staff_id=" . $last_staff_id . "\"" . "\n                }\n            }" : "";
        $bargain_p = new \app\bargain\info\PermissionBargain($this->_uniacid);
        $bargain_auth = $bargain_p->pAuth();
        $bargain = $bargain_auth ? ",\n            {\n                \"title\": \"我的砍价\",\n                \"icon\": \"iconkanjiajilu\",\n                \"link\": {\n                    \"type\": 2,\n                    \"url\": \"/shop/pages/bargain/record\"\n                }\n            }" : "";
        $moduleMenuShop = "{\n    \"title\": \"商城工具\",\n    \"type\": \"moduleMenuShop\",\n    \"icon\": \"iconshop\",\n    \"isDelete\": true,\n    \"addNumber\": 1,\n    \"attr\": [\n        {\n            \"title\": \"模板名称\",\n            \"type\": \"Switch\",\n            \"name\": \"isShowTitle\"\n        },\n        {\n            \"title\": \"选择模板\",\n            \"type\": \"ChooseModule\",\n            \"name\": \"module\",\n            \"data\": [\n                {\n                    \"title\": \"一行多列\",\n                    \"name\": \"module-menu-row\",\n                    \"img\": \"http://longbingcdn.xiaochengxucms.com/admin/diy/module-menu-col.jpg\"\n                },\n                {\n                    \"title\": \"一行一列\",\n                    \"name\": \"module-menu-col\",\n                    \"img\": \"http://longbingcdn.xiaochengxucms.com/admin/diy/module-menu-row.jpg\"\n                }\n            ]\n        },\n        {\n            \"title\": \"一行多少列\",\n            \"type\": \"InputNumber\",\n            \"name\": \"row\"\n        }\n    ],\n    \"data\": {\n        \"isShowTitle\": false,\n        \"module\": \"module-menu-row\",\n        \"row\": {\n            \"number\": 4,\n            \"min\": 2,\n            \"max\": 5,\n            \"label\": \"请输入\"\n        },\n        \"list\": [\n            {\n                \"title\": \"我的售后\",\n                \"icon\": \"iconwodeshouhou\",\n                \"link\": {\n                    \"type\": 2,\n                    \"url\": \"/shop/pages/refund/list\"\n                }\n            },\n            {\n                \"title\": \"我的收入\",\n                \"icon\": \"icontixianguanli\",\n                \"link\": {\n                    \"type\": 2,\n                    \"url\": \"/shop/pages/partner/income\"\n                }\n            },\n            {\n                \"title\": \"我的卡券\",\n                \"icon\": \"iconwodekaquan\",\n                \"link\": {\n                    \"type\": 2,\n                    \"url\": \"/shop/pages/coupon/list\"\n                }\n            },\n            {\n                \"title\": \"分销商品\",\n                \"icon\": \"iconquanmianfenxiao\",\n                \"link\": {\n                    \"type\": 2,\n                    \"needStaffId\": true,\n                    \"url\": \"/shop/pages/partner/distribution?staff_id=" . $last_staff_id . "\"\n                }\n            },\n            {\n                \"title\": \"我的地址\",\n                \"icon\": \"icondizhi2\",\n                \"link\": {\n                    \"type\": 2,\n                    \"url\": \"/shop/pages/address/list\"\n                }\n            }" . $bargain . "\n            " . $tmp . "\n        ]\n    }\n\n}";
        $permission = new PermissionShop($this->_uniacid);
        $compoentList = [];
        if($permission->pAuth()) {
            $compoentList = [json_decode($moduleMenuShopOrder, true), json_decode($moduleMenuShop, true)];
        }
        return $compoentList;
    }
    public function onAgentAppAuthEdit($config)
    {
        $returnArr = [];
        $permission = new PermissionShop(0);
        $shop_switch = [];
        if($permission->sAuth() && $permission->infoConfig["auth_platform"]) {
            $shop_switch["formType"] = "radio";
            $shop_switch["name"] = "shop_switch";
            $shop_switch["value"] = $config ? $config[$shop_switch["name"]] : 0;
            $shop_switch["title"] = $permission->info["title"];
            $returnArr[] = $shop_switch;
        }
        $pay_shop = [];
        if($permission->sAuth() && $permission->infoConfig["auth_platform"]) {
            $pay_shop["formType"] = "radio";
            $pay_shop["name"] = "pay_shop";
            $pay_shop["value"] = $config ? $config[$pay_shop["name"]] : 0;
            $pay_shop["title"] = $permission->info["title"] . "支付";
            $returnArr[] = $pay_shop;
        }
        return $returnArr;
    }
}

?>